<%--
    Document   : index.jsp
    Created on : 12/04/2011, 06:33:41 PM
    Author     : mvalentin
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.Calendar"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<% 
    Calendar c1 = Calendar.getInstance();
    String dia = Integer.toString(c1.get(Calendar.DATE));
    String mes = Integer.toString(c1.get(Calendar.MONTH)+1);
    String annio = Integer.toString(c1.get(Calendar.YEAR));
    if(dia.length()==1){
        dia = "0"+dia;
    }
    if(mes.length()==1){
        mes = "0"+mes;
    }
    String fechaActual = dia+"/"+mes+"/"+annio;
%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Complejo Fronterizo Santa Rosa</title>

        <script type="text/javascript" src="viator/js/lista.js"></script>
        <script type="text/javascript" src="viator/js/pasajero.js"></script>
        <script type="text/javascript" src="js/funciones.js"></script>
        <script type="text/javascript" src="viator/js/conductor.js"></script>
        <script type="text/javascript" src="viator/js/vehiculo.js"></script>

    

        <script type="text/javascript">

            dojo.addOnLoad(function() {
                formDlg = dijit.byId("captcha");
                //var registrarPasajeros = dijit.byId("registro");
                //dojo.connect(dijit.byId("registrar"), "onClick", registrarPasajeros, "show");
            });
       
            var dataStore=null;
            var grid=null;
            dojo.ready(function() {
                dataStore = new dojo.data.ItemFileReadStore({
                    clearOnClose:true,
                    url:"Pasajero.do?operacion=cargarPasajero&nlipa_codigo=-1"
                });
                grid = dijit.byId("billsGrid");
                grid.setStore(dataStore);
            });



        </script>
    </head>

    <body class="claro" >

  
        <div dojoType="dijit.form.Form" id="myForm" jsId="myForm" encType="multipart/form-data">

            <table align="center">
                <tr align="center">
                    <td>
                        
                    </td>
                    <td valign="top">
                        <img id="imgcapcha" name="imgcapcha" src="CaptchaServlet" alt="capcha"/>
                    </td>
                </tr>
                <tr align="center">
                    <td width="200px;">Ingrese letras y n&uacute;meros mostrados en la imagen:</td>
                    <td>
                        <input dojoType="dijit.form.TextBox" type="text" name="captcha" id="captcha">
                    </td>
                </tr>
                <tr align="center">
                    <td>
                        <!--  fnValidarCaptcha('01')-->
                        <button id="registrar" dojoType="dijit.form.Button" type="button" onclick=" fnCarganuevo();">
                            Registrar Nueva <br>
                            Lista de Pasajeros
                        </button>
                    </td>
                    <td align="center">
                        <!--  fnValidarCaptcha('02');-->
                        <button id="modificar" dojoType="dijit.form.Button" type="button" onclick="fnCargamodificar();">Modificar
                            <br>
                            Lista de Pasajeros
                        </button>
                    </td>
                </tr>
            </table>
        </div>
 

        <div dojoType="dijit.Dialog" id="registro" title="Registro de Nueva Relación de Pasajeros" style="width: 80%; height: 450px;">
            <form name="frmcabecera">

                <input type="hidden" name="accion" id="accion" value=""/>

                <table width="100%" style="padding: 0px 0px 0px 0px">
                <tr>
                    <td width="40%" align="left">
                        Destino :
                        &nbsp;&nbsp;&nbsp;
                        <input dojoType="dijit.form.RadioButton" type="radio" name="Pais21" id="Pais21" value="AR" checked="checked">ARICA
                        &nbsp;&nbsp;&nbsp;
                        <input dojoType="dijit.form.RadioButton" type="radio" name="Pais21" id="Pais22" value="TA" >TACNA
                    </td>
                    <td width="10%">
                        <label for="salida">Fecha de Viaje:</label>
                    </td>
                    <td width="15%">
                        <input type="hidden" name="hfecha" id="hfecha" value="<%=fechaActual%>"/>
                        <input dojoType="dijit.form.DateTextBox" type="text" name="fecha" id="fecha" value="<%=fechaActual%>" required="true"/>
                    </td>
                    <td width="25%" align="right">
                        <label for="salida">Nro. Relación Pasajero:</label>
                    </td>
                    <td width="10%">
                        <input type="hidden" name="nlipa_codigo" id="nlipa_codigo" value="<bean:write name='nlipa_codigo'/>">
                        <input dojoType="dijit.form.TextBox" type="text" name="clipa_autogenerado" id="clipa_autogenerado" readonly value="<bean:write name='clipa_autogenerado'/>" style="width:130px;">
                    </td>
                </tr>
            </table>
            </form>



            <div id="accordion" dojoType="dijit.layout.AccordionContainer" style="width: 100%; height: 300px;" >
                <div class="element" title="Datos del Vehiculo" selected="true" dojoType="dijit.layout.ContentPane">
                    <input type="hidden" name="nvehi_codigo" id="nvehi_codigo"/>
                    <table>
                        <tr>
                            <td>
                                <label for="vehiculo">Tipo de Vehiculo:</label>
                            </td>
                            <td>
                                <select style="width: 200px;" id="ntive_codigo" name="ntive_codigo" dojoType="dijit.form.FilteringSelect"
                                   autoComplete="true" selectOnClick="true" >
                                    <logic:iterate id="tipovehiculo" name="listaTipoVehiculo">
                                        <option value='<bean:write name="tipovehiculo" property="ntive_codigo" />'>
                                            <bean:write name="tipovehiculo" property="ctive_descripcion" />
                                        </option>
                                    </logic:iterate>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label for="pais">Pais:</label>
                            </td>
                            <td>
                                <select style="width: 200px;" dojoType="dijit.form.FilteringSelect" autoComplete="true"
                                      selectOnClick="true" id="npais_codigovehiculo" name="npais_codigovehiculo">
                                    <logic:iterate id="pais" name="listaPaisesSuda">
                                        <option value='<bean:write name="pais" property="npais_codigo" />'>
                                            <bean:write name="pais" property="cpais_nombre" />
                                        </option>
                                    </logic:iterate>
                                </select>
                            </td>
                            <td width="10%"></td>
                            <td>
                                <label for="cvehi_numeroplaca">Placa:</label>
                            </td>
                            <td>
                                <input type="text" dojoType="dijit.form.TextBox" uppercase="true" name="cvehi_numeroplaca" id="cvehi_numeroplaca" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label for="cvehi_marca">Marca:</label>
                            </td>
                            <td>
                                <input  dojoType="dijit.form.TextBox" uppercase="true" name="cvehi_marca"  id="cvehi_marca" onkeypress="ponerMayusculas(this)">
                            </td>
                            <td></td>
                            <td>
                                <label for="cvehi_modelo">Modelo:</label>
                            </td>
                            <td>
                                <input dojoType="dijit.form.TextBox" uppercase="true" type="text" name="cvehi_modelo" id="cvehi_modelo">
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label for="cvehi_numeromotor">N/S Motor:</label>
                            </td>
                            <td>
                                <input dojoType="dijit.form.TextBox" uppercase="true" type="text" name="cvehi_numeromotor" id="cvehi_numeromotor">
                            </td>
                            <td></td>
                            <td>
                                <label for="dvehi_fabricacion">A&ntilde;o de Fabricacion:</label>
                            </td>
                            <td>
                                <input type="text" dojoType="dijit.form.NumberTextBox" constraints="{min:1900,max:2013,pattern:'####'}" required="true"  name="nvehi_fabricacion" id="nvehi_fabricacion"  maxlength="4">
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label for="cvehi_numerochasis">N/S Chasis:</label>
                            </td>
                            <td>
                                <input dojoType="dijit.form.TextBox" uppercase="true" type="text" name="cvehi_numerochasis" id="cvehi_numerochasis">
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="element" title="Datos del Conductor" dojoType="dijit.layout.ContentPane">
                    <input type="hidden" name="npers_codigo" id="npers_codigo"/>
                    <table>
                        <tr>
                            <td>
                                Pa&iacute;s:
                            </td>
                            <td colspan="3">
                                <select style="width: 200px;" dojoType="dijit.form.FilteringSelect"
                                        autoComplete="true" selectOnClick="true" id="npais_codigo" name="npais_codigo">
                                    <logic:iterate id="pais" name="listaPaises">
                                        <option value='<bean:write name="pais" property="npais_codigo" />'>
                                            <bean:write name="pais" property="cpais_nombre" />
                                        </option>
                                    </logic:iterate>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Identidad:&nbsp;
                            </td>
                            <td>
                                <select style="width: 200px;" dojoType="dijit.form.FilteringSelect"
                                        autoComplete="false" selectOnClick="true" id="ntido_codigo" name="ntido_codigo" >
                                    <logic:iterate id="doc" name="listaDocumentos">
                                        <option value="<bean:write name='doc' property='ntido_codigo'/>">
                                            <bean:write name="doc" property="ctido_descripcion"/>
                                        </option>
                                    </logic:iterate>
                                </select>
                            </td>
                            <td>
                                Nro:&nbsp;
                            </td>
                            <td>
                                <input type="text" dojoType="dijit.form.TextBox" uppercase="true" style="width: 200px" id="cdope_numero" name="cdope_numero" size="20" maxlength="20" onkeypress="return soloLetrasYnumeros(event);"/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Nombres:&nbsp;
                            </td>
                            <td>
                                <input dojoType="dijit.form.TextBox" uppercase="true" type="text" style="width: 200px" id="cpers_nombres" name="cpers_nombres"/>
                            </td>
                            <td>
                                Estado:&nbsp;
                            </td>
                            <td>
                                <select style="width: 200px;"  dojoType="dijit.form.FilteringSelect" autoComplete="false"
                                        selectOnClick="true" id="nesci_codigo" name="nesci_codigo">
                                    <logic:iterate id="estado" name="listaEstados">
                                        <option selected value="<bean:write name='estado' property='nesci_codigo'/>">
                                            <bean:write name="estado" property="cesci_descripcion"/>
                                        </option>
                                    </logic:iterate>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                A. Paterno:&nbsp;
                            </td>
                            <td>
                                <input dojoType="dijit.form.TextBox" uppercase="true" type="text" id="cpers_apepaterno" name="cpers_apepaterno"/>
                            </td>
                            <td>
                                Ocupaci&oacute;n:&nbsp;
                            </td>
                            <td>
                                <input dojoType="dijit.form.TextBox" uppercase="true" type="text" name="cpers_ocupacion" id="cpers_ocupacion" value="" size="40" maxlength="40"/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                A. Materno:&nbsp;
                            </td>
                            <td colspan="3">
                                <input dojoType="dijit.form.TextBox" uppercase="true" type="text" id="cpers_apematerno" name="cpers_apematerno"/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Fecha Nacimiento:
                            </td>
                            <td colspan="3">
                                <input dojoType="dijit.form.DateTextBox" type="text" id="dpers_fechanacimientoconductor" name="dpers_fechanacimientoconductor"/>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4" align="center">
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </div>



                <div id="wnpasajero" dojoType="dijit.Dialog" title="Pasajero" style="width:320px; visibility:hidden">
                    <%@include file="viator/frmPasajero.jsp"%>
                 </div>



                <div class="element" title="Datos del Pasajero" dojoType="dijit.layout.ContentPane" style="width: 100%; height: 100%;">
                    <div class="claro" style="width: 100%; height: 100%; font-size: 10px;">
                        <!--- Cabecera de Datos Pasajeros -->
                        <table width="100%">
                            <tr>
                                <td>
                                    <span dojoType="dijit.form.Button">
                                        Agregar
                                        <script type="dojo/method" event="onClick" args="evt">
                                            fnCargarFrmPasajero();
                                        </script>
                                    </span>
                                    <span dojoType="dijit.form.Button">
                                        Modificar
                                        <script type="dojo/method" event="onClick" args="evt">
                                            fnModificarPasajero('billsGrid');
                                        </script>
                                    </span>
                                    <span dojoType="dijit.form.Button">
                                        Eliminar
                                        <script type="dojo/method" event="onClick" args="evt">
                                            fnEliminarPasajero('billsGrid');
                                        </script>
                                    </span>
                                </td>
                            </tr>
                        </table>
                        <!--Fin de Cabecera -->
                        <table id="billsGrid" dojoType="dojox.grid.DataGrid" width="100%">
                            <thead>
                                <tr>
                                    <th field="tipodoc" width="10%">TIPO DOCU.</th>
                                    <th field="nro" width="10%">NRO DOCU.</th>
                                    <th field="nombre" width="15%">NOMBRE</th>
                                    <th field="paterno" width="10%">A. APELLIDOS</th>
                                    <th field="materno" width="10%">A. MATERNO</th>
                                    <th field="estado" width="20%">ESTADO CIVIL</th>
                                    <th field="ocupacion" width="20%">OCUPACION</th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
             <table align="center">
                <tr align="center">
                    <td>
                     <button dojoType="dijit.form.Button" type="button" onclick="fnGrabarGeneral();">Imprimir Manifiesto</button>
                     <button dojoType="dijit.form.Button" type="button" onclick="fnDescargarGeneral();">Descargar Manifiesto</button>
                    </td>
                </tr>
            </table>
        </div>


        <!-- MODIFICAR tabbed pane-->

        <div dojoType="dijit.Dialog" id="modifica" title="Modificar manifiesto de pasajeros">
            <div dojoType="dijit.layout.TabContainer" style="width: 600px; height: 250px;" tabPosition="left-h" tabStrip="true">
                <div dojoType="dijit.layout.ContentPane" title="Nro Orden" selected="true">
                    <table>
                        <tr>
                            <td><label for="nroorden">Nro de Orden </label></td>
                            <td><input dojoType="dijit.form.TextBox" type="text" name="nroordenmod" id="nroordenmod"></td>
                        </tr>
                        <tr>
                            <td colspan="2" align="right">
                                <button dojoType="dijit.form.Button" type="button" onclick="fnBuscarListaNroOrden();">BUSCAR</button>
                            </td>
                        </tr>
                    </table>
                </div>

                <div dojoType="dijit.layout.ContentPane" title="Vehiculo">
                    <table>
                        <tr>
                            <td>
                                <label for="pais2mod">Pais Vehiculo</label>
                            </td>
                            <td>
                                 <select  id="PaisCarromod" name="PaisCarromod" style="width: 200px;" autoComplete="false">
                                     <option value="" >-TODOS-</option>
                                    <logic:iterate id="pais" name="listaPaises">
                                        <option value='<bean:write name="pais" property="npais_codigo" />'>
                                            <bean:write name="pais" property="cpais_nombre" />
                                        </option>
                                    </logic:iterate>
                                </select>
                            </td>
                            <td width="10%"></td>
                            <td><label for="placamod">Placa </label></td>
                            <td><input dojoType="dijit.form.TextBox" uppercase="true" type="text" name="placa" id="placamod"></td>
                        </tr>
                        <tr>
                            <td><label for="pais2mod">Pais Conductor</label></td>
                            <td>
                                <select   id="PaisConmod" name="PaisCon" style="width: 200px;" autoComplete="false">
                                    <option value="" >-TODOS-</option>
                                    <logic:iterate id="pais" name="listaPaises">
                                        <option value='<bean:write name="pais" property="npais_codigo" />'>
                                            <bean:write name="pais" property="cpais_nombre" />
                                        </option>
                                    </logic:iterate>
                                </select>

                            </td>
                        </tr>
                        <tr>
                            <td><label for="pais">Tipo ID</label></td>
                            <td>
                                <select  id="tipoIdmod" name="tipoIdmod" style="width: 200px;"   autoComplete="false" >
                                    <option value="" >-TODOS-</option>
                                    <logic:iterate id="doc" name="listaDocumentos">
                                        <option value="<bean:write name='doc' property='ntido_codigo'/>">
                                            <bean:write name="doc" property="ctido_descripcion"/>
                                        </option>
                                    </logic:iterate>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td><label for="marca">Nro </label></td>
                            <td><input dojoType="dijit.form.TextBox" type="text" name="nromod" id="nromod"></td>
                        </tr>
                        <tr>
                            <td colspan="6" align="right">
                                <button dojoType="dijit.form.Button" type="button" onclick="fnBuscarListaVehiculo();">BUSCAR</button>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
           
        </div>

        <!-- Lista de pasajeros registrados para modificar -->
        <div dojoType="dijit.Dialog" id="modificaLista" title="Listas de Pasajeros" style="width: 600px; height: 300px;">
       
                <div class="claro" style="width: 100%; height: 300px; font-size: 10px; background-color: #FFF;">
                    <table width="100%">
                        <tr>
                            <td>
                                <button id="btncargaModificar" dojoType="dijit.form.Button" type="button" onclick="modificarLista();">
                                   Modificar
                                </button>

                                <span dojoType="dijit.form.Button">
                                    Eliminar
                                    <script type="dojo/method" event="onClick" args="evt">
                                        fnEliminarLista();
                                    </script>
                                </span>
                            </td>
                        </tr>
                    </table>
                    <!--Fin de Cabecera -->
                    <table id="listaGrid" dojoType="dojox.grid.DataGrid" width="100%" selectionMode="single"
                           loadingMessage="Cargando Listas..." rowCount="5">
                        <thead>
                            <tr>
                                <th field="nlipa_codigo" hidden="true" width="10%">Lista</th>
                                <th field="cvehi_numeroplaca" width="10%">Placa</th>
                                <th field="cvehi_marca" width="10%">Marca</th>
                                <th field="cvehi_conductor" width="25%">Conductor</th>
                                <th field="dlipa_viaje" width="10%">Fecha Viaje</th>
                                <th field="nlipa_qty" width="10%">Qty</th>
                            </tr>
                        </thead>
                    </table>

                </div>

        </div>
    </body>
</html>